
* Raw data to be dowloaded from https://dbk.gesis.org/DBKsearch/SDESC2.asp?no=6770&tab=3&db=E

global path  "~"


quietly log close _all


/*********/
/* Setup */
/*********/

set more off

set matsize 800

use "$path\ZA6770_v2-1-0.dta", clear



log using "$path\Script.smcl", replace



/***************/
/* Identifiers */
/***************/

/* Number of Person */

/*

CASEID

*/

/* Date of Interview */

// Year

/*

DATEYR

*/

// Month

/*

DATEMO

*/

// Day

/*

DATEDY

*/

/* Mode of Interview */

/*

MODE

*/

/* Weight of Observation */

/*

WEIGHT

*/

/* Number of Country */

/*

country

*/



/************/
/* Outcomes */
/************/

/* Evaluative Measures */
/***********************/

/* Job Satisfaction */

/*

v44

*/

generate v44_rec = v44

replace v44_rec = -2 if(v44_rec == 0)
replace v44_rec = -8 if(v44_rec == 8)
replace v44_rec = -1 if(v44_rec == 9)

recode v44_rec (1 = 7) (7 = 1) (2 = 6) (6 = 2) (3 = 5) (5 = 3)

/* Experience Measures */
/***********************/

/* Worries About Job Security */

/*

v52

*/

generate v52_rec = v52

replace v52_rec = -2 if(v52_rec == 0)
replace v52_rec = -8 if(v52_rec == 8)
replace v52_rec = -1 if(v52_rec == 9)

recode v52_rec (1 = 4) (4 = 1) (2 = 3) (3 = 2)

/* Eudemonic Measures */
/**********************/

/* Pride in Firm */

/*

v46

*/

generate v46_rec = v46

replace v46_rec = -2 if(v46_rec == 0)
replace v46_rec = -8 if(v46_rec == 8)
replace v46_rec = -1 if(v46_rec == 9)

recode v46_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)


generate v46_rec_5 = .

replace v46_rec_5 = 1 if(v46_rec == 5)
replace v46_rec_5 = 0 if(v46_rec == 4 | v46_rec == 3 | v46_rec == 2 | v46_rec == 1)

generate v46_rec_54 = .

replace v46_rec_54 = 1 if(v46_rec == 5 | v46_rec == 4)
replace v46_rec_54 = 0 if(v46_rec == 3 | v46_rec == 2 | v46_rec == 1)

/* Pride in Work */

/*

v49

*/

generate v49_rec = v49

replace v49_rec = -2 if(v49_rec == 0)
replace v49_rec = -8 if(v49_rec == 8)
replace v49_rec = -1 if(v49_rec == 9)

recode v49_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)


generate v49_rec_5 = .

replace v49_rec_5 = 1 if(v49_rec == 5)
replace v49_rec_5 = 0 if(v49_rec == 4 | v49_rec == 3 | v49_rec == 2 | v49_rec == 1)

generate v49_rec_54 = .

replace v49_rec_54 = 1 if(v49_rec == 5 | v49_rec == 4)
replace v49_rec_54 = 0 if(v49_rec == 3 | v49_rec == 2 | v49_rec == 1)

/* Willingness to Work Harder */

/*

v45

*/

generate v45_rec = v45

replace v45_rec = -2 if(v45_rec == 0)
replace v45_rec = -8 if(v45_rec == 8)
replace v45_rec = -9 if(v45_rec == 9)

recode v45_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

/* Retention */

/*

v47

*/

generate v47_rec = v47

replace v47_rec = -2 if(v47_rec == 0)
replace v47_rec = -8 if(v47_rec == 8)
replace v47_rec = -1 if(v47_rec == 9)

recode v47_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)



/**********************************/
/* Primary Regressors of Interest */
/**********************************/

/* Working */
/***********/

/*

v20

*/

generate v20_rec = v20

replace v20_rec = -1 if(v20_rec == 9)

tabulate v20_rec, generate(temp)

rename temp2 is_working

drop temp1
drop temp3

/* Working Hours Mismatch */
/**************************/

/*

v21

*/

generate v21_rec = v21

replace v21_rec = -2 if(v21_rec == 0)
replace v21_rec = -8 if(v21_rec == 8)
replace v21_rec = -1 if(v21_rec == 9)

tabulate v21_rec, generate(temp)

rename temp4 wants_more_hours
rename temp5 wants_same_hours
rename temp6 wants_less_hours

drop temp1
drop temp2
drop temp3

/* Job Characteristics */
/***********************/

/* Attributes */

// Job Security

/*

v22

*/

generate v22_rec = v22

replace v22_rec = -2 if(v22_rec == 0)
replace v22_rec = -8 if(v22_rec == 8)
replace v22_rec = -1 if(v22_rec == 9)

recode v22_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v22_rec_5 = .

replace v22_rec_5 = 1 if(v22_rec == 5)
replace v22_rec_5 = 0 if(v22_rec == 4 | v22_rec == 3 | v22_rec == 2 | v22_rec == 1)

generate v22_rec_54 = .

replace v22_rec_54 = 1 if(v22_rec == 5 | v22_rec == 4)
replace v22_rec_54 = 0 if(v22_rec == 3 | v22_rec == 2 | v22_rec == 1)

// Income

/*

v23

*/

generate v23_rec = v23

replace v23_rec = -2 if(v23_rec == 0)
replace v23_rec = -8 if(v23_rec == 8)
replace v23_rec = -1 if(v23_rec == 9)

recode v23_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v23_rec_5 = .

replace v23_rec_5 = 1 if(v23_rec == 5)
replace v23_rec_5 = 0 if(v23_rec == 4 | v23_rec == 3 | v23_rec == 2 | v23_rec == 1)

generate v23_rec_54 = .

replace v23_rec_54 = 1 if(v23_rec == 5 | v23_rec == 4)
replace v23_rec_54 = 0 if(v23_rec == 3 | v23_rec == 2 | v23_rec == 1)

// Opportunities for Advancement

/*

v24

*/

generate v24_rec = v24

replace v24_rec = -2 if(v24_rec == 0)
replace v24_rec = -8 if(v24_rec == 8)
replace v24_rec = -1 if(v24_rec == 9)

recode v24_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v24_rec_5 = .

replace v24_rec_5 = 1 if(v24_rec == 5)
replace v24_rec_5 = 0 if(v24_rec == 4 | v24_rec == 3 | v24_rec == 2 | v24_rec == 1)

generate v24_rec_54 = .

replace v24_rec_54 = 1 if(v24_rec == 5 | v24_rec == 4)
replace v24_rec_54 = 0 if(v24_rec == 3 | v24_rec == 2 | v24_rec == 1)

// Interesting Job

/*

v25

*/

generate v25_rec = v25

replace v25_rec = -2 if(v25_rec == 0)
replace v25_rec = -8 if(v25_rec == 8)
replace v25_rec = -1 if(v25_rec == 9)

recode v25_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v25_rec_5 = .

replace v25_rec_5 = 1 if(v25_rec == 5)
replace v25_rec_5 = 0 if(v25_rec == 4 | v25_rec == 3 | v25_rec == 2 | v25_rec == 1)

generate v25_rec_54 = .

replace v25_rec_54 = 1 if(v25_rec == 5 | v25_rec == 4)
replace v25_rec_54 = 0 if(v25_rec == 3 | v25_rec == 2 | v25_rec == 1)

// Independent Work

/*

v26

*/

generate v26_rec = v26

replace v26_rec = -2 if(v26_rec == 0)
replace v26_rec = -8 if(v26_rec == 8)
replace v26_rec = -1 if(v26_rec == 9)

recode v26_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v26_rec_5 = .

replace v26_rec_5 = 1 if(v26_rec == 5)
replace v26_rec_5 = 0 if(v26_rec == 4 | v26_rec == 3 | v26_rec == 2 | v26_rec == 1)

generate v26_rec_54 = .

replace v26_rec_54 = 1 if(v26_rec == 5 | v26_rec == 4)
replace v26_rec_54 = 0 if(v26_rec == 3 | v26_rec == 2 | v26_rec == 1)

// Helping Other People

/*

v27

*/

generate v27_rec = v27

replace v27_rec = -2 if(v27_rec == 0)
replace v27_rec = -8 if(v27_rec == 8)
replace v27_rec = -1 if(v27_rec == 9)

recode v27_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v27_rec_5 = .

replace v27_rec_5 = 1 if(v27_rec == 5)
replace v27_rec_5 = 0 if(v27_rec == 4 | v27_rec == 3 | v27_rec == 2 | v27_rec == 1)

generate v27_rec_54 = .

replace v27_rec_54 = 1 if(v27_rec == 5 | v27_rec == 4)
replace v27_rec_54 = 0 if(v27_rec == 3 | v27_rec == 2 | v27_rec == 1)

// Being Useful to Society

/*

v28

*/

generate v28_rec = v28

replace v28_rec = -2 if(v28_rec == 0)
replace v28_rec = -8 if(v28_rec == 8)
replace v28_rec = -1 if(v28_rec == 9)

recode v28_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v28_rec_5 = .

replace v28_rec_5 = 1 if(v28_rec == 5)
replace v28_rec_5 = 0 if(v28_rec == 4 | v28_rec == 3 | v28_rec == 2 | v28_rec == 1)

generate v28_rec_54 = .

replace v28_rec_54 = 1 if(v28_rec == 5 | v28_rec == 4)
replace v28_rec_54 = 0 if(v28_rec == 3 | v28_rec == 2 | v28_rec == 1)

// Contact With Other People

/*

v29

*/

generate v29_rec = v29

replace v29_rec = -2 if(v29_rec == 0)
replace v29_rec = -8 if(v29_rec == 8)
replace v29_rec = -1 if(v29_rec == 9)

recode v29_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v29_rec_5 = .

replace v29_rec_5 = 1 if(v29_rec == 5)
replace v29_rec_5 = 0 if(v29_rec == 4 | v29_rec == 3 | v29_rec == 2 | v29_rec == 1)

generate v29_rec_54 = .

replace v29_rec_54 = 1 if(v29_rec == 5 | v29_rec == 4)
replace v29_rec_54 = 0 if(v29_rec == 3 | v29_rec == 2 | v29_rec == 1)

/* Frequencies */

// Hard Physical Work

/*

v30

*/

generate v30_rec = v30

replace v30_rec = -2 if(v30_rec == 0)
replace v30_rec = -8 if(v30_rec == 8)
replace v30_rec = -1 if(v30_rec == 9)

recode v30_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v30_rec_5 = .

replace v30_rec_5 = 1 if(v30_rec == 5)
replace v30_rec_5 = 0 if(v30_rec == 4 | v30_rec == 3 | v30_rec == 2 | v30_rec == 1)

generate v30_rec_54 = .

replace v30_rec_54 = 1 if(v30_rec == 5 | v30_rec == 4)
replace v30_rec_54 = 0 if(v30_rec == 3 | v30_rec == 2 | v30_rec == 1)

// Stressful Work

/*

v31

*/

generate v31_rec = v31

replace v31_rec = -2 if(v31_rec == 0)
replace v31_rec = -8 if(v31_rec == 8)
replace v31_rec = -1 if(v31_rec == 9)

recode v31_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v31_rec_5 = .

replace v31_rec_5 = 1 if(v31_rec == 5)
replace v31_rec_5 = 0 if(v31_rec == 4 | v31_rec == 3 | v31_rec == 2 | v31_rec == 1)

generate v31_rec_54 = .

replace v31_rec_54 = 1 if(v31_rec == 5 | v31_rec == 4)
replace v31_rec_54 = 0 if(v31_rec == 3 | v31_rec == 2 | v31_rec == 1)

// Working From Home

/*

v32

*/

generate v32_rec = v32

replace v32_rec = -2 if(v32_rec == 0)
replace v32_rec = -8 if(v32_rec == 8)
replace v32_rec = -1 if(v32_rec == 9)

recode v32_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v32_rec_5 = .

replace v32_rec_5 = 1 if(v32_rec == 5)
replace v32_rec_5 = 0 if(v32_rec == 4 | v32_rec == 3 | v32_rec == 2 | v32_rec == 1)

generate v32_rec_54 = .

replace v32_rec_54 = 1 if(v32_rec == 5 | v32_rec == 4)
replace v32_rec_54 = 0 if(v32_rec == 3 | v32_rec == 2 | v32_rec == 1)

// Working on Weekends

/*

v33

*/

generate v33_rec = v33

replace v33_rec = -2 if(v33_rec == 0)
replace v33_rec = -8 if(v33_rec == 8)
replace v33_rec = -1 if(v33_rec == 9)

recode v33_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v33_rec_5 = .

replace v33_rec_5 = 1 if(v33_rec == 5)
replace v33_rec_5 = 0 if(v33_rec == 4 | v33_rec == 3 | v33_rec == 2 | v33_rec == 1)

generate v33_rec_54 = .

replace v33_rec_54 = 1 if(v33_rec == 5 | v33_rec == 4)
replace v33_rec_54 = 0 if(v33_rec == 3 | v33_rec == 2 | v33_rec == 1)

/* Working Hours Conditions */
/****************************/

/*

v34

*/

generate v34_rec = v34

replace v34_rec = -2 if(v34_rec == 0)
replace v34_rec = -8 if(v34_rec == 8)
replace v34_rec = -1 if(v34_rec == 9)

tabulate v34_rec, generate(temp)

rename temp4 working_hours_fixed
rename temp5 working_hours_flexible
rename temp6 working_hours_free

drop temp1
drop temp2
drop temp3

/* Typical Working Schedule */
/****************************/

/*

v35

*/

generate v35_rec = v35

replace v35_rec = -2 if(v35_rec == 0)
replace v35_rec = -8 if(v35_rec == 8)
replace v35_rec = -1 if(v35_rec == 9)

tabulate v35_rec, generate(temp)

rename temp4 working_schedule_fixed
rename temp5 working_schedule_flexible
rename temp6 working_schedule_free

drop temp1
drop temp2
drop temp3

/* Organisation of Daily Work */
/******************************/

/*

v36

*/

generate v36_rec = v36

replace v36_rec = -2 if(v36_rec == 0)
replace v36_rec = -8 if(v36_rec == 8)
replace v36_rec = -1 if(v36_rec == 9)

tabulate v36_rec, generate(temp)

rename temp4 daily_work_free
rename temp5 daily_work_flexible
rename temp6 daily_work_fixed

drop temp1
drop temp2
drop temp3

/* Difficulty of Taking Time Off */
/*********************************/

/*

v37

*/

generate v37_rec = v37

replace v37_rec = -2 if(v37_rec == 0)
replace v37_rec = -8 if(v37_rec == 8)
replace v37_rec = -1 if(v37_rec == 9)

generate v37_rec_4 = .

replace v37_rec_4 = 1 if(v37_rec == 4)
replace v37_rec_4 = 0 if(v37_rec == 3 | v37_rec == 2 | v37_rec == 1)

generate v37_rec_43 = .

replace v37_rec_43 = 1 if(v37_rec == 4 | v37_rec == 3)
replace v37_rec_43 = 0 if(v37_rec == 2 | v37_rec == 1)

/* Work-Life Balance */
/*********************/

/* Work Interfering With Family */

/*

v38

*/

generate v38_rec = v38

replace v38_rec = -2 if(v38_rec == 0)
replace v38_rec = -8 if(v38_rec == 8)
replace v38_rec = -1 if(v38_rec == 9)

recode v38_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v38_rec_5 = .

replace v38_rec_5 = 1 if(v38_rec == 5)
replace v38_rec_5 = 0 if(v38_rec == 4 | v38_rec == 3 | v38_rec == 2 | v38_rec == 1)

generate v38_rec_54 = .

replace v38_rec_54 = 1 if(v38_rec == 5 | v38_rec == 4 )
replace v38_rec_54 = 0 if(v38_rec == 3 | v38_rec == 2 | v38_rec == 1)

/* Family Interfering with Work */

/*

v39

*/

generate v39_rec = v39

replace v39_rec = -2 if(v39_rec == 0)
replace v39_rec = -8 if(v39_rec == 8)
replace v39_rec = -1 if(v39_rec == 9)

recode v39_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v39_rec_5 = .

replace v39_rec_5 = 1 if(v39_rec == 5)
replace v39_rec_5 = 0 if(v39_rec == 4 | v39_rec == 3 | v39_rec == 2 | v39_rec == 1)

generate v39_rec_54 = .

replace v39_rec_54 = 1 if(v39_rec == 5 | v39_rec == 4 )
replace v39_rec_54 = 0 if(v39_rec == 3 | v39_rec == 2 | v39_rec == 1)

/* Job Fit */
/***********/

/* Skills Match */

/*

v40

*/

generate v40_rec = v40

replace v40_rec = -2 if(v40_rec == 0 | v40_rec == 5)
replace v40_rec = -8 if(v40_rec == 8)
replace v40_rec = -1 if(v40_rec == 9)

generate v40_rec_4 = .

replace v40_rec_4 = 1 if(v40_rec == 4)
replace v40_rec_4 = 0 if(v40_rec == 3 | v40_rec == 2 | v40_rec == 1)

generate v40_rec_43 = .

replace v40_rec_43 = 1 if(v40_rec == 4 | v40_rec == 3)
replace v40_rec_43 = 0 if(v40_rec == 2 | v40_rec == 1)

/* Skills Training */

/*

v41

*/

generate v41_rec = v41

replace v41_rec = -2 if(v41_rec == 0)
replace v41_rec = -8 if(v41_rec == 8)
replace v41_rec = -1 if(v41_rec == 9)

tabulate v41_rec, generate(temp)

rename temp4 had_skills_training

drop temp1
drop temp2
drop temp3
drop temp5

/* Relationships */
/*****************/

/* Relationship Between Management and Employees */

/*

v42

*/

generate v42_rec = v42

replace v42_rec = -2 if(v42_rec == 0)
replace v42_rec = -8 if(v42_rec == 8)
replace v42_rec = -1 if(v42_rec == 9)

recode v42_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v42_rec_5 = .

replace v42_rec_5 = 1 if(v42_rec == 5)
replace v42_rec_5 = 0 if(v42_rec == 4 | v42_rec == 3 | v42_rec == 2 | v42_rec == 1)

generate v42_rec_54 = .

replace v42_rec_54 = 1 if(v42_rec == 5 | v42_rec == 4 )
replace v42_rec_54 = 0 if(v42_rec == 3 | v42_rec == 2 | v42_rec == 1)

/* Relationship Between Employees */

/*

v43

*/

generate v43_rec = v43

replace v43_rec = -2 if(v43_rec == 0)
replace v43_rec = -8 if(v43_rec == 8)
replace v43_rec = -1 if(v43_rec == 9)

recode v43_rec (1 = 5) (5 = 1) (2 = 4) (4 = 2)

generate v43_rec_5 = .

replace v43_rec_5 = 1 if(v43_rec == 5)
replace v43_rec_5 = 0 if(v43_rec == 4 | v43_rec == 3 | v43_rec == 2 | v43_rec == 1)

generate v43_rec_54 = .

replace v43_rec_54 = 1 if(v43_rec == 5 | v43_rec == 4 )
replace v43_rec_54 = 0 if(v43_rec == 3 | v43_rec == 2 | v43_rec == 1)



/************************************/
/* Secondary Regressors of Interest */
/************************************/

/* Employment Status */
/*********************/

/*

MAINSTAT

*/

/* Employment Characteristics */
/******************************/

/* Extensive Margin */

/*

WORK

*/

/* Intensive Margin */

/*

WRKHRS

*/

generate works_full_time = .

replace works_full_time = 1 if(WRKHRS >= 35 & WRKHRS != 8 & WRKHRS != 9)
replace works_full_time = 0 if(WRKHRS < 35 & WRKHRS != 0)

generate works_part_time = .

replace works_part_time = 1 if(WRKHRS < 35 & WRKHRS != 0)
replace works_part_time = 0 if(WRKHRS >= 35 & WRKHRS != 8 & WRKHRS != 9) 

generate working_hours = .

replace working_hours = WRKHRS if(WRKHRS != 98 & WRKHRS != 99)

generate ln_working_hours = ln(working_hours)

/* Relationship of Employment */

/*

EMPREL

*/

tabulate EMPREL, generate(temp)

rename temp2 is_employee
rename temp3 is_self_employed_wo_employees
rename temp4 is_self_employed_w_employees
rename temp5 works_family_business

drop temp1
drop temp6

generate is_self_employed = .

replace is_self_employed = 1 if(is_self_employed_wo_employees == 1 | is_self_employed_w_employees == 1 | works_family_business == 1)
replace is_self_employed = 0 if(is_employee == 1)

/* Supervision of Employees */

/*

WRKSUP

*/

tabulate WRKSUP, generate(temp)

rename temp2 is_supervising_employees

drop temp1
drop temp3
drop temp4
drop temp5

/* Type of Organisation */

// Profit Versus Non-Profit

/*

TYPORG1

*/

tabulate TYPORG1, generate(temp)

rename temp2 works_profit_organisation
rename temp3 works_nonprofit_organisation

drop temp1
drop temp4
drop temp5

// Private Versus Public

/*

TYPORG2

*/

tabulate TYPORG2, generate(temp)

rename temp2 works_public_organisation
rename temp3 works_nonpublic_organisation

drop temp1
drop temp4
drop temp5

/* Occupation */

/*

ISCO08

*/

// Occupation

generate is_manager = .

replace is_manager = 1 if(ISCO08 >= 1 & ISCO08 < 2000)
replace is_manager = 0 if(is_manager != 1 & ISCO08 != 0)

generate is_professional = .

replace is_professional = 1 if(ISCO08 >= 2000 & ISCO08 < 3000)
replace is_professional = 0 if(is_professional != 1 & ISCO08 != 0)

generate is_technician = .

replace is_technician = 1 if(ISCO08 >= 3000 & ISCO08 < 4000)
replace is_technician = 0 if(is_technician != 1 & ISCO08 != 0)

generate is_clerical_support_worker = .

replace is_clerical_support_worker = 1 if(ISCO08 >= 4000 & ISCO08 < 5000)
replace is_clerical_support_worker = 0 if(is_clerical_support_worker != 1 & ISCO08 != 0)

generate is_service_sales_worker = .

replace is_service_sales_worker = 1 if(ISCO08 >= 5000 & ISCO08 < 6000)
replace is_service_sales_worker = 0 if(is_service_sales_worker != 1 & ISCO08 != 0)

generate is_agricultural_worker = .

replace is_agricultural_worker = 1 if(ISCO08 >= 6000 & ISCO08 < 7000)
replace is_agricultural_worker = 0 if(is_agricultural_worker != 1 & ISCO08 != 0)

generate is_craft_trade_worker = .

replace is_craft_trade_worker = 1 if(ISCO08 >= 7000 & ISCO08 < 8000)
replace is_craft_trade_worker = 0 if(is_craft_trade_worker != 1 & ISCO08 != 0)

generate is_operator_assembler = .

replace is_operator_assembler = 1 if(ISCO08 >= 8000 & ISCO08 < 9000)
replace is_operator_assembler = 0 if(is_operator_assembler != 1 & ISCO08 != 0)

generate has_elementary_occupation = .

replace has_elementary_occupation = 1 if(ISCO08 >= 9000 & ISCO08 < 10000)
replace has_elementary_occupation = 0 if(has_elementary_occupation != 1 & ISCO08 != 0)

generate is_soldier = .

replace is_soldier = 1 if(ISCO08 >= 10000 & ISCO08 < 11000)
replace is_soldier = 0 if(is_soldier != 1 & ISCO08 != 0)

generate is_manager_professional = .

replace is_manager_professional = 1 if(is_manager == 1 | is_professional == 1)
replace is_manager_professional = 0 if(is_technician == 1 | is_clerical_support_worker == 1 | is_service_sales_worker == 1 | is_agricultural_worker == 1 | is_craft_trade_worker == 1 | is_operator_assembler == 1 | has_elementary_occupation == 1)

generate is_elementary_worker = .

replace is_elementary_worker = 1 if(is_craft_trade_worker == 1 | is_operator_assembler == 1 | has_elementary_occupation == 1)
replace is_elementary_worker = 0 if(is_manager == 1 | is_professional == 1 | is_technician == 1 | is_clerical_support_worker == 1 | is_service_sales_worker == 1 | is_agricultural_worker == 1)

rename ISCO08 occupation_industry

// Industry

/*

-

*/

/* Job Type */

generate is_white_collar_worker = .

replace is_white_collar_worker = 1 if(is_manager == 1 | is_professional == 1 | is_technician == 1 | is_clerical_support_worker == 1 | is_service_sales_worker == 1)
replace is_white_collar_worker = 0 if(is_agricultural_worker == 1 | is_craft_trade_worker == 1 | is_operator_assembler == 1 | has_elementary_occupation == 1 | is_soldier == 1)

generate is_blue_collar_worker = .

replace is_blue_collar_worker = 1 if(is_agricultural_worker == 1 | is_craft_trade_worker == 1 | is_operator_assembler == 1 | has_elementary_occupation == 1)
replace is_blue_collar_worker = 0 if(is_manager == 1 | is_professional == 1 | is_technician == 1 | is_clerical_support_worker == 1 | is_service_sales_worker == 1 | is_soldier == 1)

/* Union Membership */

/*

UNION

*/

tabulate UNION, generate(temp)

rename temp2 is_union_member

drop temp1
drop temp3
drop temp4
drop temp5
drop temp6



/********************/
/* Other Regressors */
/********************/

/* Individual Characteristics */
/******************************/

/* Age */

/*

AGE

DK_AGE

*/

generate age = .

replace age = AGE if(AGE != 999 & AGE != 0)

replace age = 22 if(DK_AGE == 22)
replace age = 31 if(DK_AGE == 31)
replace age = 41 if(DK_AGE == 41)
replace age = 51 if(DK_AGE == 51)
replace age = 61 if(DK_AGE == 61)
replace age = 70 if(DK_AGE == 70)

generate age_squared = age * age

/* Gender */

/*

SEX

*/

tabulate SEX, generate(temp)

rename temp2 is_female

drop temp1
drop temp3

/* Marital Status */

/*

MARITAL

*/

generate is_partnership = .

replace is_partnership = 1 if(MARITAL == 1 | MARITAL == 2)
replace is_partnership = 0 if(MARITAL == 3 | MARITAL == 4 | MARITAL == 5 | MARITAL == 6)

generate is_separated = .

replace is_separated = 1 if(MARITAL == 3)
replace is_separated = 0 if(MARITAL == 1 | MARITAL == 2 | MARITAL == 4 | MARITAL == 5 | MARITAL == 6)

generate is_divorced = .

replace is_divorced = 1 if(MARITAL == 4)
replace is_divorced = 0 if(MARITAL == 1 | MARITAL == 2 | MARITAL == 3 | MARITAL == 5 | MARITAL == 6)

generate is_widowed = .

replace is_widowed = 1 if(MARITAL == 5)
replace is_widowed = 0 if(MARITAL == 1 | MARITAL == 2 | MARITAL == 3 | MARITAL == 4 | MARITAL == 6)

generate is_single = .

replace is_single = 1 if(MARITAL == 6)
replace is_single = 0 if(MARITAL == 1 | MARITAL == 2 | MARITAL == 3 | MARITAL == 4 | MARITAL == 5)

/* Education */

// Years of Schooling

/*

EDUCYRS

*/

generate years_education = .

replace years_education = EDUCYRS if(EDUCYRS != 95 & EDUCYRS != 96 & EDUCYRS != 98 & EDUCYRS != 99)

// Degree

/*

DEGREE

*/

tabulate DEGREE, generate(temp)

rename temp1 has_no_formal_schooling
rename temp2 has_primary_schooling
rename temp3 has_lower_secondary_schooling
rename temp4 has_upper_secondary_schooling
rename temp5 has_post_secondary_schooling
rename temp6 has_lower_tertiary_schooling
rename temp7 has_upper_tertiary_schooling

drop temp8

generate education_low = .

replace education_low = 1 if(has_no_formal_schooling == 1 | has_primary_schooling == 1)
replace education_low = 0 if(has_lower_secondary_schooling == 1 | has_upper_secondary_schooling == 1 | has_post_secondary_schooling == 1 | has_lower_tertiary_schooling == 1 | has_upper_tertiary_schooling == 1)

generate education_medium = .
replace education_medium = 1 if(has_lower_secondary_schooling == 1 | has_upper_secondary_schooling == 1 | has_post_secondary_schooling == 1)
replace education_medium = 0 if(has_no_formal_schooling == 1 | has_primary_schooling == 1 | has_lower_tertiary_schooling == 1 | has_upper_tertiary_schooling == 1)

generate education_high = .
replace education_high = 1 if(has_lower_tertiary_schooling == 1 | has_upper_tertiary_schooling == 1)
replace education_high = 0 if(has_no_formal_schooling == 1 | has_primary_schooling == 1 | has_lower_secondary_schooling == 1 | has_upper_secondary_schooling == 1 | has_post_secondary_schooling == 1)

/* Religion */

/*

RELIGGRP

*/

/* Income */

/*

AT_RINC
AU_RINC
BE_RINC
CH_RINC
CL_RINC
CN_RINC
CZ_RINC
DE_RINC
DK_RINC
EE_RINC
ES_RINC
FI_RINC
FR_RINC
GB_RINC
GE_RINC
HR_RINC
HU_RINC
IL_RINC
IN_RINC
IS_RINC
JP_RINC
LT_RINC
LV_RINC
MX_RINC
NO_RINC
NZ_RINC
PH_RINC
PL_RINC
RU_RINC
SE_RINC
SI_RINC
SK_RINC
SR_RINC
TW_RINC
US_RINC
VE_RINC
ZA_RINC

*/

replace AT_RINC = . if(AT_RINC == 999990 | AT_RINC == 999999)
replace AU_RINC = . if(AU_RINC == 999990 | AU_RINC == 999999)
replace BE_RINC = . if(BE_RINC == 999990 | BE_RINC == 999999)
replace CH_RINC = . if(CH_RINC == 999990 | CH_RINC == 999997 | CH_RINC == 999998 | CH_RINC == 999999)
replace CL_RINC = . if(CL_RINC == 9999990 | CL_RINC == 9999998 | CL_RINC == 9999999)
replace CN_RINC = . if(CN_RINC == 9999990 | CN_RINC == 9999996 | CN_RINC == 9999997 | CN_RINC == 9999998 | CN_RINC == 9999999)
replace CZ_RINC = . if(CZ_RINC == 999990 | CZ_RINC == 999997 | CZ_RINC == 999998)
replace DE_RINC = . if(DE_RINC == 999990 | DE_RINC == 999999)
replace DK_RINC = . if(DK_RINC == 999990 | DK_RINC == 999999)
replace EE_RINC = . if(EE_RINC == 999990 | EE_RINC == 999997 | EE_RINC == 999998 | EE_RINC == 999999)
replace ES_RINC = . if(ES_RINC == 999990 | ES_RINC == 999998 | ES_RINC == 999999)
replace FI_RINC = . if(FI_RINC == 999990 | FI_RINC == 999999)
replace FR_RINC = . if(FR_RINC == 999990 | FR_RINC == 999999)
replace GB_RINC = . if(GB_RINC == 999990 | GB_RINC == 999997)
replace GE_RINC = . if(GE_RINC == 999990)
replace HR_RINC = . if(HR_RINC == 999990 | HR_RINC == 999999)
replace HU_RINC = . if(HU_RINC == 999990 | HU_RINC == 999997 | HU_RINC == 999998)
replace IL_RINC = . if(IL_RINC == 999990 | IL_RINC == 999997 | IL_RINC == 999998 | IL_RINC == 999999)
replace IN_RINC = . if(IN_RINC == 999990 | IN_RINC == 999999)
replace IS_RINC = . if(IS_RINC == 9999990 | IS_RINC == 9999997 | IS_RINC == 9999998 | IS_RINC == 9999999)
replace JP_RINC = . if(JP_RINC == 1.10e+07 | JP_RINC == 1.35e+07 | JP_RINC == 2.00e+07 | JP_RINC == 1.00e+08 | JP_RINC == 1.00e+08)
replace LT_RINC = . if(LT_RINC == 999990 | LT_RINC == 999997 | LT_RINC == 999998)
replace LV_RINC = . if(LV_RINC == 999990 | LV_RINC == 999997 | LV_RINC == 999998)
replace MX_RINC = . if(MX_RINC == 999990 | MX_RINC == 999997 | MX_RINC == 999998 | MX_RINC == 999999)
replace NO_RINC = . if(NO_RINC == 9999990 | NO_RINC == 9999998 | NO_RINC == 9999999)
replace NZ_RINC = . if(NZ_RINC == 999990 | NZ_RINC == 999999)
replace PH_RINC = . if(PH_RINC == 999990 | PH_RINC == 999997 | PH_RINC == 999998 | PH_RINC == 999999)
replace PL_RINC = . if(PL_RINC == 999990 | PL_RINC == 999998 | PL_RINC == 999999)
replace RU_RINC = . if(RU_RINC == 999990 | RU_RINC == 999997 | RU_RINC == 999998)
replace SE_RINC = . if(SE_RINC == 999990 | SE_RINC == 999999)
replace SI_RINC = . if(SI_RINC == 999990 | SI_RINC == 999997 | SI_RINC == 999998 | SI_RINC == 999999)
replace SK_RINC = . if(SK_RINC == 999990 | SK_RINC == 999998 | SK_RINC == 999999)
replace SR_RINC = . if(SR_RINC == 999990 | SR_RINC == 999998 | SR_RINC == 999999)
replace TW_RINC = . if(TW_RINC == 999990 | TW_RINC == 999997)
replace US_RINC = . if(US_RINC == 999990 | US_RINC == 999997 | US_RINC == 999998)
replace VE_RINC = . if(VE_RINC == 999990 | VE_RINC == 999999)
replace ZA_RINC = . if(ZA_RINC == 999990 | ZA_RINC == 999997 | ZA_RINC == 999998 | ZA_RINC == 999999)

generate individual_income = .

replace individual_income = AT_RINC if(country == 40)
replace individual_income = AU_RINC if(country == 36)
replace individual_income = BE_RINC if(country == 56)
replace individual_income = CH_RINC if(country == 756)
replace individual_income = CL_RINC if(country == 152)
replace individual_income = CN_RINC if(country == 156)
replace individual_income = CZ_RINC if(country == 203)
replace individual_income = DE_RINC if(country == 276)
replace individual_income = DK_RINC if(country == 208)
replace individual_income = EE_RINC if(country == 233)
replace individual_income = ES_RINC if(country == 724)
replace individual_income = FI_RINC if(country == 246)
replace individual_income = FR_RINC if(country == 250)
replace individual_income = GB_RINC if(country == 826)
replace individual_income = GE_RINC if(country == 268)
replace individual_income = HR_RINC if(country == 191)
replace individual_income = HU_RINC if(country == 348)
replace individual_income = IL_RINC if(country == 376)
replace individual_income = IN_RINC if(country == 356)
replace individual_income = IS_RINC if(country == 352)
replace individual_income = JP_RINC if(country == 392)
replace individual_income = LT_RINC if(country == 440)
replace individual_income = LV_RINC if(country == 428)
replace individual_income = MX_RINC if(country == 484)
replace individual_income = NO_RINC if(country == 578)
replace individual_income = NZ_RINC if(country == 554)
replace individual_income = PH_RINC if(country == 608)
replace individual_income = PL_RINC if(country == 616)
replace individual_income = RU_RINC if(country == 643)
replace individual_income = SE_RINC if(country == 752)
replace individual_income = SI_RINC if(country == 705)
replace individual_income = SK_RINC if(country == 703)
replace individual_income = SR_RINC if(country == 740)
replace individual_income = TW_RINC if(country == 158)
replace individual_income = US_RINC if(country == 840)
replace individual_income = VE_RINC if(country == 862)
replace individual_income = ZA_RINC if(country == 710)

generate ln_individual_income = ln(individual_income)

/* Household Characteristics */
/*****************************/

/* Number of Persons */

/*

HOMPOP

*/

generate number_individuals_household = .

replace number_individuals_household = HOMPOP if(HOMPOP != 99)


/* Number of Children */

// Above School Age

/*

HHCHILDR

*/

generate number_children_household = .

replace number_children_household = HHCHILDR if(HHCHILDR != 96 & HHCHILDR != 99)

// Below School Age

/*

HHTODD

*/

generate number_toddlers_household = .

replace number_toddlers_household = HHTODD if(HHTODD != 96 & HHTODD != 99)

/* Region */

/*

URBRURAL

*/

/* Income */

/*

AT_INC
AU_INC
BE_INC
CH_INC
CL_INC
CN_INC
CZ_INC
DE_INC
DK_INC
EE_INC
ES_INC
FI_INC
FR_INC
GB_INC
GE_INC
HR_INC
HU_INC
IL_INC
IN_INC
IS_INC
JP_INC
LT_INC
LV_INC
MX_INC
NO_INC
NZ_INC
PH_INC
PL_INC
RU_INC
SE_INC
SI_INC
SK_INC
SR_INC
TW_INC
US_INC
VE_INC
ZA_INC

*/

/* Income */

generate region_1 = 0
replace region_1 = 1 if(country == 36 | country == 554)
label variable region_1 "Australia & NZ"

generate region_2 = 0
replace region_2 = 1 if(country == 643)
label variable region_2 "CIS"

generate region_3 = 0
replace region_3 = 1 if(country == 156 | country == 158 | country == 392)
label variable region_3 "East Asia"

generate region_4 = 0
replace region_4 = 1 if(country == 40 | country == 56 | country == 191 | country == 203 | country == 208 | country == 233 | country == 246 | country == 250 | country == 268 | country == 276 | country == 348 | country == 352 | country == 428 | country == 440 | country == 578 | country == 616 | country == 703 | country == 705 | country == 724 | country == 752 | country == 756 | country == 826)
label variable region_4 "Europe"

generate region_5 = 0
replace region_5 = 1 if(country == 152 | country == 484 | country == 740 | country == 862)
label variable region_5 "Latin America & Carib"

generate region_6 = 0
replace region_6 = 1 if(country == 376)
label variable region_6 "Middle East & N Africa"

generate region_7 = 0
replace region_7 = 1 if(country == 840)
label variable region_7 "Northern America"

generate region_8 = 0
replace region_8 = 1 if(country == 356)
label variable region_8 "South Asia"

generate region_9 = 0
replace region_9 = 1 if(country == 608)
label variable region_9 "Southeast Asia"

generate region_10 = 0
replace region_10 = 1 if(country == 710)
label variable region_10 "Sub-Saharan Africa"



/************/
/* Missings */
/************/

mvdecode _all, mv(-1 = .a)
mvdecode _all, mv(-2 = .b)
mvdecode _all, mv(-8 = .h)



/**********/
/* Sample */
/**********/

keep if((is_working == 1 & working_hours > 0) & number_individuals_household > 0)



/********************/
/* Standardisations */
/********************/

/* Outcomes */

foreach x of varlist v44_rec v52_rec /* v46_rec */ /* v49_rec */ v45_rec v47_rec {
	
	egen `x'_m = mean(`x')
	
	egen `x'_sd = sd(`x')
	
	generate `x'_z = ((`x' - `x'_m) / `x'_sd)
	
	drop `x'_m
	
	drop `x'_sd
	
}	

/* Regressors of Interest */

foreach x of varlist v22_rec v24_rec v23_rec ln_individual_income v30_rec v31_rec v26_rec v32_rec daily_work_fixed daily_work_free working_hours_fixed working_hours_free working_schedule_fixed working_schedule_free ln_working_hours wants_more_hours wants_less_hours v33_rec v38_rec v37_rec v29_rec v42_rec v43_rec v25_rec v40_rec had_skills_training v27_rec v28_rec v46_rec v49_rec {
	
	egen `x'_m = mean(`x')
	
	egen `x'_sd = sd(`x')
	
	generate `x'_z = ((`x' - `x'_m) / `x'_sd)
	
	drop `x'_m
	
	drop `x'_sd
	
}	

/* Other Regressors */

foreach x of varlist is_union_member age age_squared is_female is_partnership is_separated is_divorced is_widowed years_education number_individuals_household number_children_household number_toddlers_household {
	
	egen `x'_m = mean(`x')
	
	egen `x'_sd = sd(`x')
	
	generate `x'_z = ((`x' - `x'_m) / `x'_sd)
	
	drop `x'_m
	
	drop `x'_sd
	
}	



/************/
/* Analyses */
/************/

global x1 "is_union_member_z"
global x2 "age_z age_squared_z is_female_z is_partnership_z is_separated_z is_divorced_z is_widowed_z years_education_z number_individuals_household_z number_children_household_z number_toddlers_household_z"
global x3 "i.occupation_industry i.country"

/* Summary Statistics */
/**********************/



/* Regressions */
/***************/

/* Plain */

global security "v22_rec_z"

global advancement "v24_rec_z"

global pay "v23_rec_z ln_individual_income_z"

global difficulty_danger_stress "v30_rec_z v31_rec_z"

global flexibility_autonomy "v26_rec_z v32_rec_z daily_work_fixed_z daily_work_free_z working_hours_fixed_z working_hours_free_z working_schedule_fixed_z working_schedule_free_z"

global hours "ln_working_hours_z"

global hours_mismatch "wants_more_hours_z wants_less_hours_z"

global work_life_balance "v33_rec_z v38_rec_z v37_rec_z"

global social_capital_relationships "v29_rec_z v42_rec_z v43_rec_z"

global interestingness "v25_rec_z"

global skills_match "v40_rec_z had_skills_training_z"

global social_usefulness "v27_rec_z v28_rec_z"

// Average - Complete

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3, cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_average_full.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2) label ctitle ("v44_rec_z") addtext(controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

// Average - Incomplete

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3, cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_average.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

// By Employment

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_self_employed == 0), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_employment.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_self_employed == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_employment.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

// By Time

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(works_full_time == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_time.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(works_part_time == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_time.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

// By Gender

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_female == 0), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_gender.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_female == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_gender.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

// By Education

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(education_low == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_education.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(education_medium == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_education.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(education_high == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_education.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

// By Occupation

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_manager_professional == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_occupation.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_technician == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_occupation.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_clerical_support_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_occupation.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_service_sales_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_occupation.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_agricultural_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_occupation.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

reg v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness $x1 $x2 $x3 if(is_elementary_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_plain_occupation.xls", excel keep($pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

/* Principle Components */

global security "v22_rec_z"

global advancement "v24_rec_z"

global pay "v23_rec_z ln_individual_income_z"

global difficulty_danger_stress "v30_rec_z v31_rec_z"

global flexibility_autonomy "v26_rec_z v32_rec_z daily_work_fixed_z daily_work_free_z working_hours_fixed_z working_hours_free_z working_schedule_fixed_z working_schedule_free_z"

global hours "ln_working_hours_z"

global hours_mismatch "wants_more_hours_z wants_less_hours_z"

global work_life_balance "v33_rec_z v38_rec_z v37_rec_z"

global social_capital_relationships "v29_rec_z v42_rec_z v43_rec_z"

global interestingness "v25_rec_z"

global skills_match "v40_rec_z had_skills_training_z"

global social_usefulness "v27_rec_z v28_rec_z"

pca $pay
predict pay_f, score
label variable pay_f "pay_f"

pca $difficulty_danger_stress
predict difficulty_danger_stress_f, score
label variable difficulty_danger_stress_f "difficulty_danger_stress_f"

pca $flexibility_autonomy
predict flexibility_autonomy_f, score
label variable flexibility_autonomy_f "flexibility_autonomy_f"

pca $hours_mismatch
predict hours_mismatch_f, score
label variable hours_mismatch_f "hours_mismatch_f"

pca $work_life_balance
predict work_life_imbalance_f, score
label variable work_life_imbalance_f "work_life_imbalance_f"

pca $social_capital_relationships
predict social_capital_rel_f, score
label variable social_capital_rel_f "social_capital_rel_f"

pca $skills_match
predict skills_match_f, score
label variable skills_match_f "skills_match_f"

pca $social_usefulness
predict social_usefulness_f, score
label variable social_usefulness_f "social_usefulness_f"

foreach x of varlist pay_f difficulty_danger_stress_f flexibility_autonomy_f hours_mismatch_f work_life_imbalance_f social_capital_rel_f skills_match_f social_usefulness_f {
	
	egen `x'_m = mean(`x')
	
	egen `x'_sd = sd(`x')
	
	generate `x'_z = ((`x' - `x'_m) / `x'_sd)
	
	drop `x'_m
	
	drop `x'_sd
	
}	

// Average - Complete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3, cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_average_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

// Average - Incomplete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3, cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_average.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

estimates store average

coefplot average, mlabel mlabposition(2) mlabgap(2) mlabsize(2.5) format(%9.2f) keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) xline(0) xtitle("Effect Estimate") title("Effect of Workplace Quality on Job Satisfaction") coeflabels(pay_f_z = "Pay" ln_working_hours_z = "Working Hours" hours_mismatch_f_z = "Working Hours Mismatch" work_life_imbalance_f_z = "Work-Life Imbalance" skills_match_f_z = "Skills Match" v22_rec_z = "Job Security" difficulty_danger_stress_f_z = "Difficulty, Stress, Danger" v24_rec_z = "Opportunities for Advancement" flexibility_autonomy_f_z = "Independence" v25_rec_z = "Interesting Job" social_capital_rel_f_z = "Interpersonal Relationships" social_usefulness_f_z = "Usefulness") legend(off) xsize(20) ysize(12) saving("$path\results_continuous_standardised_principle_components_average", replace) name(average, replace)

window manage close graph average

// By Employment - Complete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_self_employed == 0), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_employment_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_self_employed == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_employment_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

// By Employment - Incomplete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_self_employed == 0), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_employment.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

estimates store employed

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_self_employed == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_employment.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store self_employed

coefplot employed self_employed, format(%9.2f) keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) xline(0) xtitle("Effect Estimate") title("Effect of Workplace Quality on Job Satisfaction") coeflabels(pay_f_z = "Pay" ln_working_hours_z = "Working Hours" hours_mismatch_f_z = "Working Hours Mismatch" work_life_imbalance_f_z = "Work-Life Imbalance" skills_match_f_z = "Skills Match" v22_rec_z = "Job Security" difficulty_danger_stress_f_z = "Difficulty, Stress, Danger" v24_rec_z = "Opportunities for Advancement" flexibility_autonomy_f_z = "Independence" v25_rec_z = "Interesting Job" social_capital_rel_f_z = "Interpersonal Relationships" social_usefulness_f_z = "Usefulness") legend(order(2 "Employed" 4 "Self-Employed") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) saving("$path\results_continuous_standardised_principle_components_employment", replace) name(employment, replace)

window manage close graph employment

// By Time - Complete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(works_full_time == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_time_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(works_part_time == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_time_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

// By Time - Incomplete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(works_full_time == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_time.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

estimates store full_time

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(works_part_time == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_time.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store part_time

coefplot full_time part_time, format(%9.2f) keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) xline(0) xtitle("Effect Estimate") title("Effect of Workplace Quality on Job Satisfaction") coeflabels(pay_f_z = "Pay" ln_working_hours_z = "Working Hours" hours_mismatch_f_z = "Working Hours Mismatch" work_life_imbalance_f_z = "Work-Life Imbalance" skills_match_f_z = "Skills Match" v22_rec_z = "Job Security" difficulty_danger_stress_f_z = "Difficulty, Stress, Danger" v24_rec_z = "Opportunities for Advancement" flexibility_autonomy_f_z = "Independence" v25_rec_z = "Interesting Job" social_capital_rel_f_z = "Interpersonal Relationships" social_usefulness_f_z = "Usefulness") legend(order(2 "Full-Time" 4 "Part-Time") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) saving("$path\results_continuous_standardised_principle_components_time", replace) name(time, replace)

window manage close graph time

// By Gender - Complete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_female == 0), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_gender_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_female == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_gender_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

// By Gender - Incomplete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_female == 0), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_gender.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

estimates store male

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_female == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_gender.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store female

coefplot male female, format(%9.2f) keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) xline(0) xtitle("Effect Estimate") title("Effect of Workplace Quality on Job Satisfaction") coeflabels(pay_f_z = "Pay" ln_working_hours_z = "Working Hours" hours_mismatch_f_z = "Working Hours Mismatch" work_life_imbalance_f_z = "Work-Life Imbalance" skills_match_f_z = "Skills Match" v22_rec_z = "Job Security" difficulty_danger_stress_f_z = "Difficulty, Stress, Danger" v24_rec_z = "Opportunities for Advancement" flexibility_autonomy_f_z = "Independence" v25_rec_z = "Interesting Job" social_capital_rel_f_z = "Interpersonal Relationships" social_usefulness_f_z = "Usefulness") legend(order(2 "Male" 4 "Female") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) saving("$path\results_continuous_standardised_principle_components_gender", replace) name(gender, replace)

window manage close graph gender

// By Education - Complete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(education_low == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_education_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(education_medium == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_education_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(education_high == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_education_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

// By Education - Incomplete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(education_low == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_education.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

estimates store education_low

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(education_medium == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_education.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store education_medium

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(education_high == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_education.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store education_high

coefplot education_low education_medium education_high, format(%9.2f) keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) xline(0) xtitle("Effect Estimate") title("Effect of Workplace Quality on Job Satisfaction") coeflabels(pay_f_z = "Pay" ln_working_hours_z = "Working Hours" hours_mismatch_f_z = "Working Hours Mismatch" work_life_imbalance_f_z = "Work-Life Imbalance" skills_match_f_z = "Skills Match" v22_rec_z = "Job Security" difficulty_danger_stress_f_z = "Difficulty, Stress, Danger" v24_rec_z = "Opportunities for Advancement" flexibility_autonomy_f_z = "Independence" v25_rec_z = "Interesting Job" social_capital_rel_f_z = "Interpersonal Relationships" social_usefulness_f_z = "Usefulness") legend(order(2 "Low Education" 4 "Medium Education" 6 "High Education") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) saving("$path\results_continuous_standardised_principle_components_education", replace) name(education, replace)

window manage close graph education

// By Occupation - Complete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_manager_professional == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 replace

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_technician == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_clerical_support_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_service_sales_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_elementary_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_elementary_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation_full.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) adjr2 append

// By Occupation - Incomplete

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_manager_professional == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 replace

estimates store is_manager_professional

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_technician == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store is_technician

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_clerical_support_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store is_clerical_support_worker

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_service_sales_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store is_service_sales_worker

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_agricultural_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store is_agricultural_worker

reg v44_rec_z pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z $x1 $x2 $x3 if(is_elementary_worker == 1), cluster(country) robust
outreg2 using "$path\results_continuous_standardised_principle_components_occupation.xls", excel keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) label ctitle ("v44_rec_z") addtext(constant, yes, controls, yes, occupation fe, yes, industry fe, yes, country fe, yes, cluster, country) nocons adjr2 append

estimates store is_elementary_worker

coefplot is_manager_professional is_technician is_clerical_support_worker is_service_sales_worker is_agricultural_worker is_elementary_worker, format(%9.2f) keep(pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z) xline(0) xtitle("Effect Estimate") title("Effect of Workplace Quality on Job Satisfaction") coeflabels(pay_f_z = "Pay" ln_working_hours_z = "Working Hours" hours_mismatch_f_z = "Working Hours Mismatch" work_life_imbalance_f_z = "Work-Life Imbalance" skills_match_f_z = "Skills Match" v22_rec_z = "Job Security" difficulty_danger_stress_f_z = "Difficulty, Stress, Danger" v24_rec_z = "Opportunities for Advancement" flexibility_autonomy_f_z = "Independence" v25_rec_z = "Interesting Job" social_capital_rel_f_z = "Interpersonal Relationships" social_usefulness_f_z = "Usefulness") legend(order(2 "Manager or Professional" 4 "Technician" 6 "Clerical or Support Worker" 8 "Service or Sales Worker" 10 "Agricultural Worker" 12 "Elementary Worker") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) saving("$path\results_continuous_standardised_principle_components_occupation", replace) name(occupation, replace)

window manage close graph occupation

/*

drop pay_f_z

drop difficulty_danger_stress_f_z

drop flexibility_autonomy_f_z

drop hours_mismatch_f_z

drop work_life_imbalance_f_z

drop social_capital_rel_f

drop skills_match_f_z

drop social_usefulness_f_z

*/

/* Descriptive Statistics, By Region */

sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_1 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_2 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_3 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_4 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_5 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_6 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_7 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_8 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_9 == 1)
sum v44_rec_z $pay $hours $hours_mismatch $work_life_balance $skills_match $security $difficulty_danger_stress $advancement $flexibility_autonomy $interestingness $social_capital_relationships $social_usefulness [aw=WEIGHT] if(region_10 == 1)

/* Correlation Between Job Satisfaction and Willingness to Turn Down Offer */

corr(v44_rec v47_rec)

/* Additions */

// Old Summary Statistics: Indicators

foreach x of varlist wants_same_hours daily_work_flexible working_hours_flexible working_schedule_flexible {
	
	egen `x'_m = mean(`x')
	
	egen `x'_sd = sd(`x')
	
	generate `x'_z = ((`x' - `x'_m) / `x'_sd)
	
	drop `x'_m
	
	drop `x'_sd
	
}	

sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_1 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_2 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_3 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_4 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_5 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_6 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_7 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_8 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_9 == 1)
sum wants_same_hours_z daily_work_flexible_z working_hours_flexible_z working_schedule_flexible_z [aw=WEIGHT] if(region_10 == 1)

// New Summary Statistics: Indices

sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_1 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_2 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_3 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_4 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_5 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_6 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_7 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_8 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_9 == 1)
sum pay_f_z $hours hours_mismatch_f_z work_life_imbalance_f_z skills_match_f_z $security difficulty_danger_stress_f_z $advancement flexibility_autonomy_f_z $interestingness social_capital_rel_f_z social_usefulness_f_z [aw=WEIGHT] if(region_10 == 1)

// New Graphs

generate region = .

replace region = 1 if(region_1 == 1)
replace region = 2 if(region_2 == 1)
replace region = 3 if(region_3 == 1)
replace region = 4 if(region_4 == 1)
replace region = 5 if(region_5 == 1)
replace region = 6 if(region_6 == 1)
replace region = 7 if(region_7 == 1)
replace region = 8 if(region_8 == 1)
replace region = 9 if(region_9 == 1)
replace region = 10 if(region_10 == 1)

label variable v44_rec_z "Job Satisfaction"

label variable pay_f_z "Pay"
label variable ln_working_hours_z "Working Hours"
label variable hours_mismatch_f_z "Working Hours Mismatch"
label variable work_life_imbalance_f_z "Work-Life Imbalance"
label variable skills_match_f_z "Skills Match"
label variable v22_rec_z "Job Security"
label variable difficulty_danger_stress_f_z "Difficulty, Stress, Danger"
label variable v24_rec_z "Opportunities for Advancement"
label variable flexibility_autonomy_f_z "Independence"
label variable v25_rec_z "Interesting Job"
label variable social_capital_rel_f_z "Interpersonal Relationships"
label variable social_usefulness_f_z "Usefulness"

cibar v44_rec_z [aw=WEIGHT], over1(region) graphopts(title("Job Satisfaction") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_job_satisfaction", replace) name(job_satisfaction, replace))
window manage close graph job_satisfaction

cibar pay_f_z [aw=WEIGHT], over1(region) graphopts(title("Pay") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_pay", replace) name(pay, replace))
window manage close graph pay

cibar ln_working_hours_z [aw=WEIGHT], over1(region) graphopts(title("Working Hours") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_working_hours", replace) name(working_hours, replace))
window manage close graph working_hours

cibar hours_mismatch_f_z [aw=WEIGHT], over1(region) graphopts(title("Working Hours Mismatch") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_working_hours_mismatch", replace) name(working_hours_mismatch, replace))
window manage close graph working_hours_mismatch

cibar work_life_imbalance_f_z [aw=WEIGHT], over1(region) graphopts(title("Work-Life Imbalance") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_work_life_imbalance", replace) name(work_life_imbalance, replace))
window manage close graph work_life_imbalance

cibar skills_match_f_z [aw=WEIGHT], over1(region) graphopts(title("Skills Match") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_skills_match", replace) name(skills_match, replace))
window manage close graph skills_match

cibar v22_rec_z [aw=WEIGHT], over1(region) graphopts(title("Job Security") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_job_security", replace) name(job_security, replace))
window manage close graph job_security

cibar difficulty_danger_stress_f_z [aw=WEIGHT], over1(region) graphopts(title("Difficulty, Stress, Danger") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_difficulty_stress_danger", replace) name(difficulty_stress_danger, replace))
window manage close graph difficulty_stress_danger

cibar v24_rec_z [aw=WEIGHT], over1(region) graphopts(title("Opportunities for Advancement") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_opportunities_advancement", replace) name(opportunities_advancement, replace))
window manage close graph opportunities_advancement

cibar flexibility_autonomy_f_z [aw=WEIGHT], over1(region) graphopts(title("Independence") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_independence", replace) name(independence, replace))
window manage close graph independence

cibar v25_rec_z [aw=WEIGHT], over1(region) graphopts(title("Interesting Job") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_interesting_job", replace) name(interesting_job, replace))
window manage close graph interesting_job

cibar social_capital_rel_f_z [aw=WEIGHT], over1(region) graphopts(title("Interpersonal Relationships") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_interpersonal_relationships", replace) name(interpersonal_relationships, replace))
window manage close graph interpersonal_relationships

cibar social_usefulness_f_z [aw=WEIGHT], over1(region) graphopts(title("Usefulness") legend(order(1 "Australia & NZ" 2 "CIS" 3 "East Asia" 4 "Europe" 5 "Latin America & Carib" 6 "Middle East & N Africa" 7 "Northern America" 8 "South Asia" 9 "Southeast Asia" 10 "Sub-Saharan Africa") keygap(0.5) bmargin(zero)) xsize(20) ysize(12) ylabel(,format(%9.1f)) saving("$path\figure_usefulness", replace) name(usefulness, replace))
window manage close graph usefulness

/* Descriptive Statistics */

// Outcome
sum v44_rec

// Controls
sum age
sum is_female
sum is_partnership
sum is_separated
sum is_divorced
sum is_widowed
sum years_education
sum number_individuals_household
sum number_children_household
sum number_toddlers_household
sum is_union_member

// Workplace Quality

// // Pay
sum v23_rec
sum ln_individual_income

// // Working Hours
sum ln_working_hours

// // Working Hours Mismatch
sum wants_more_hours
sum wants_same_hours
sum wants_less_hours

// // Work-Life Imbalance
sum v33_rec
sum v38_rec
sum v37_rec

// // Skills Match
sum v40_rec
sum had_skills_training

// // Security
sum v22_rec

// // Difficulty, Stress, Danger
sum v30_rec
sum v31_rec

// // Opportunities for Advancement
sum v24_rec

// // Independence
sum v26_rec
sum v32_rec
sum daily_work_fixed
sum daily_work_flexible
sum daily_work_free
sum working_hours_fixed
sum working_hours_flexible
sum working_hours_free
sum working_schedule_fixed
sum working_schedule_flexible
sum working_schedule_free

// // Interestingness
sum v25_rec

// // Interpersonal Relationships
sum v29_rec
sum v42_rec
sum v43_rec

// // Usefulness
sum v27_rec
sum v28_rec

estpost sum v44_rec age is_female is_partnership is_separated is_divorced is_widowed years_education number_individuals_household number_children_household number_toddlers_household is_union_member v23_rec ln_individual_income ln_working_hours wants_more_hours wants_same_hours wants_less_hours v33_rec v38_rec v37_rec v40_rec had_skills_training v22_rec v30_rec v31_rec v24_rec v26_rec v32_rec daily_work_fixed daily_work_flexible daily_work_free working_hours_fixed working_hours_flexible working_hours_free working_schedule_fixed working_schedule_flexible working_schedule_free v25_rec v29_rec v42_rec v43_rec v27_rec v28_rec

estout using Descriptive_Statistics.xls, replace cells((mean(fmt(3)) sd(fmt(3)) min(fmt(0)) max(fmt(0)))) stats(N, fmt(%9.0fc %9.0fc %9.2f %9.0g) labels("Number of Observations")) legend label collabels(, none) title(Descriptive Statistics)




log close


